<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/js/common.js"/>"></script>
<script>
	var companyId = "${companyId }";
	if (companyId == null || companyId == '') {
		companyId = 0;
	}
	function initList(listDisplayEId) {
		$('#' + listDisplayEId)
				.datagrid(
						{
							url : "<c:url value='/shop/shopList.do'/>"
									+ "?companyId=" + companyId,
							nowrap : false,
							striped : true,
							collapsible : true,
							remoteSort : true,
							notSelectByRow : false,
							toolbar : [
									{
										id : listDisplayEId + '_btn_edit',
										text : '修改店铺',
										iconCls : 'icon-edit',
										handler : function() {

											var row = $('#' + listDisplayEId)
													.datagrid('getSelections');
											if (row.length == 0) {
												$.messager.alert('提示',
														'请选择一条记录操作！', 'info');
												return;
											} else {
												var new_win = window
														.open(
																"<c:url value='/jsp/openIndexSun.jsp?url=/shopforDlkk/preUpdateShop.do'/>"
																		+ "?shopId="
																		+ row[0]['shopId'],
																"sun",
																"width=1200px,height=600px,status=no,scrollbars=yes");
												new_win.focus();
												$('#' + listDisplayEId)
														.datagrid('reload');
											}
											$('#' + listDisplayEId).datagrid(
													'clearSelections');
										}
									},
									'-',
									{
										id : listDisplayEId + '_btn_edit',
										text : '店铺提价页面',
										iconCls : 'icon-redo',
										handler : function() {

											var row = $('#' + listDisplayEId)
													.datagrid('getSelections');
											if (row.length == 0) {
												$.messager.alert('提示',
														'请选择一条记录操作！', 'info');
												return;
											} else {
												var new_win = window
														.open(
																"<c:url value='/jsp/openIndexSun2.jsp?url=/shop/preShopRaisePrice.do'/>"
																		+ "?shopId="
																		+ row[0]['shopId'],
																"sun",
																"width=1200px,height=600px,status=no,scrollbars=yes");
												new_win.focus();
												$('#' + listDisplayEId)
														.datagrid('reload');
											}
											$('#' + listDisplayEId).datagrid(
													'clearSelections');
										}
									} ],
							onLoadError : function() {
								$.messager.alert('错误', '获取数据失败，请与管理员联系！',
										'error');
							},
							onClickRow : function(rowIndex) {
								$(".myrad").prop("checked", false);
								$(".myrad").eq(rowIndex).prop("checked", true);
							}
						});
	};
	$(document).ready(function() {
		initList('listDisplay');
	});
	function formatRadio(value, rowData, rowIndex) {
		return value = "<input type='radio' class='myrad'  name='radioStore' />";
	}
</script>
</head>
<body>
	<table width="98%">
		<tr>
			<td>
				<table id="listDisplay" title="机构列表" iconCls="icon-list"
					singleSelect="true" idField="shopId" loadMsg="请稍候......"
					pagination="true" pageSize="20" pageList="[10,20,30,40,50]"
					sortName="shopId" rownumbers="true" sortOrder="asc">
					<thead>
						<tr>
							<th field="materRole" width="25" align="center"
								formatter="formatRadio"></th>
							<th field="shopId" width="40" sortable="true" editor="text">店铺id</th>
							<th field="shopName" width="140" sortable="true">店铺名称</th>
							<th field="shopUserList" width="300" sortable="true">店铺员工列表(id-用户名-权限)</th>
							<th field="companyUserName" width="120" sortable="true">公司</th>
							<th field="code" width="80" sortable="true">供货摊位号</th>
						</tr>
					</thead>
				</table>
			</td>
		</tr>
	</table>
</body>
</html>